﻿using System;

namespace YJKCodeBase.Math
{
	public class UnitUtility
	{
		public static double MMToFeet(double val)
		{
			return val / 304.8;
		}

		public static double FeetToMM(double val)
		{
			return val * 304.8;
		}

		public static double SquareMeterToSquareFeet(double val)
		{
            return System.Math.Pow(UnitUtility.MMToFeet(System.Math.Sqrt(val) * 1000.0), 2.0);
		}

		public static double SquareFeetToSquareMeter(double val)
		{
            return System.Math.Pow(UnitUtility.FeetToMM(System.Math.Sqrt(val)) / 1000.0, 2.0);
		}

		public static double CubicMetreToCubicFeet(double val)
		{
            return System.Math.Pow(UnitUtility.MMToFeet(System.Math.Pow(val, 0.33333333333333331) * 1000.0), 3.0);
		}

		public static double CubicFeetToCubicMetre(double val)
		{
            return System.Math.Pow(UnitUtility.FeetToMM(System.Math.Pow(val, 0.33333333333333331)) / 1000.0, 3.0);
		}

		public static double AngleToRadian(double val)
		{
            return val * System.Math.PI / 180.0;
		}

		public static double RadianToAngle(double val)
		{
            return val * 180.0 / System.Math.PI;
		}

		private const double m_dMMFeetUnit = 304.8;

		private const double m_dMAndMMUnit = 1000.0;
	}
}
